package com.ruoyi.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.StudentManageMapper;
import com.ruoyi.domain.StudentManage;
import com.ruoyi.service.IStudentManageService;

import javax.annotation.Resource;

/**
 * 学生管理Service业务层处理
 * 
 * @author 孔德民
 * @date 2022-04-22
 */
@Service
public class StudentManageServiceImpl implements IStudentManageService 
{
    @Resource
    private StudentManageMapper studentManageMapper;

    /**
     * 查询学生管理
     * 
     * @param id 学生管理主键
     * @return 学生管理
     */
    @Override
    public StudentManage selectStudentManageById(Long id)
    {
        return studentManageMapper.selectStudentManageById(id);
    }

    /**
     * 查询学生管理列表
     * 
     * @param studentManage 学生管理
     * @return 学生管理
     */
    @Override
    public List<StudentManage> selectStudentManageList(StudentManage studentManage)
    {
        return studentManageMapper.selectStudentManageList(studentManage);
    }

    /**
     * 新增学生管理
     * 
     * @param studentManage 学生管理
     * @return 结果
     */
    @Override
    public int insertStudentManage(StudentManage studentManage)
    {
        studentManage.setCreateTime(DateUtils.getNowDate());
        return studentManageMapper.insertStudentManage(studentManage);
    }

    /**
     * 修改学生管理
     * 
     * @param studentManage 学生管理
     * @return 结果
     */
    @Override
    public int updateStudentManage(StudentManage studentManage)
    {
        studentManage.setUpdateTime(DateUtils.getNowDate());
        return studentManageMapper.updateStudentManage(studentManage);
    }

    /**
     * 批量删除学生管理
     * 
     * @param ids 需要删除的学生管理主键
     * @return 结果
     */
    @Override
    public int deleteStudentManageByIds(Long[] ids)
    {
        return studentManageMapper.deleteStudentManageByIds(ids);
    }

    /**
     * 删除学生管理信息
     * 
     * @param id 学生管理主键
     * @return 结果
     */
    @Override
    public int deleteStudentManageById(Long id)
    {
        return studentManageMapper.deleteStudentManageById(id);
    }

    @Override
    public void importData(List<StudentManage> list, String name) {
        for(StudentManage studentManage : list){
            studentManage.setCreateBy(name);
            studentManage.setCreateTime(DateUtils.getNowDate());
            studentManageMapper.insertStudentManage(studentManage);
        }
    }

    @Override
    public List<StudentManage> selectStudentManageListByIds(String[] ids) {
        return studentManageMapper.selectStudentManageByIds(ids);
    }
}
